import  pandas as pd
import matplotlib.pyplot as plt

# 导入数据
df1 = pd.read_excel('data.xls')
x1 = df1['姓名']
y1 = df1['语文']
y2 = df1['数学']
y3 = df1['英语']
plt.rcParams['font.sans-serif'] = ['Heiti TC']
plt.rcParams['xtick.direction'] = 'out'
plt.rcParams['ytick.direction'] = 'in'
plt.title("学生成绩分布图",fontsize=20)
plt.plot(x1,y1,label='语文',color='r')
plt.plot(x1,y2,label='数学',color='g')
plt.plot(x1,y3,label='英语',color='b')
# 网格
# plt.grid(axis='y')
# 图例
plt.legend(['语文','数学','英语'])
plt.show()


